UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VOOsb3qJjnASmQLTJfLtYM3T2Ps/E0c53fD445rgg7Y=' 
WHERE 
  key_id = '2817a323c3b08a511744adf5dc6f051d21983bcc3148a35ce5821c53ae9dce48' 
  AND (
    token = 'VOOsb3qJjnASmQLTJfLtYM3T2Ps/E0c53fD445rgg7Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025