UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QTmd3IFE4bLdeG9WWFZ4fXJJEmjdiDxylwmyGwLoEb8=' 
WHERE 
  key_id = '87d9cb87f348e7463a5fcf9d3536d98887aa756f07ac2a9ebdc11575ee03eed7' 
  AND (
    token = 'QTmd3IFE4bLdeG9WWFZ4fXJJEmjdiDxylwmyGwLoEb8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035