UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oasVuBysR6SGw/Yl0gufudsgdr05dsgKBww2OVDbTIo=' 
WHERE 
  key_id = '3eef9aecfd1f122cf247b0254b1b03be27d94b4e11795424dd25bb203d7150f6' 
  AND (
    token = 'oasVuBysR6SGw/Yl0gufudsgdr05dsgKBww2OVDbTIo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027