UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kwJyDRcHEOoP3xxr7wbiTbcTITCiS6kmec6lUk72k+c=' 
WHERE 
  key_id = '21595e5b9c6ed56b54c15be9a4e7962f332323bcc7a848f7df4f4599648efce8' 
  AND (
    token = 'kwJyDRcHEOoP3xxr7wbiTbcTITCiS6kmec6lUk72k+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023