UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fdm1SAUrGBba8+kyKXcUz2fgBzz+nxvGpjSjONXye50=' 
WHERE 
  key_id = '594053460d1aecc2a4f9f1e4e0918e05bbf45acf6309c51cf9c40fe330abbbe2' 
  AND (
    token = 'fdm1SAUrGBba8+kyKXcUz2fgBzz+nxvGpjSjONXye50=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050