UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YNPIhvM2Qzv26qnN9di060dJmghJgEdvUO5W1VVkBYU=' 
WHERE 
  key_id = 'ccb3d46d9dca0db79f9fb27549ac4fff811e4afba0ecbcd3ca3afeec271123d5' 
  AND (
    token = 'YNPIhvM2Qzv26qnN9di060dJmghJgEdvUO5W1VVkBYU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045