UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qJb3G1SsWT8XKRgxclfdK1Jw3PW+PUdZqxGRjRkULjM=' 
WHERE 
  key_id = '623dce1a225cf98622c34fac71585fc2ae536ce846aa536f4ec32f7d2af98477' 
  AND (
    token = 'qJb3G1SsWT8XKRgxclfdK1Jw3PW+PUdZqxGRjRkULjM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020