UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KRCY7hjh3+eMpknaHJPiNl8x+v0lgiypZEUU/172DWs=' 
WHERE 
  key_id = '4c775febe943a2fdb8f2522b987b3a5c4d9a6381f34eda4d957265fae7316e0e' 
  AND (
    token = 'KRCY7hjh3+eMpknaHJPiNl8x+v0lgiypZEUU/172DWs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017