UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cf8ITIYPLlZof1VuNxumItdsQEnrG5nQ5hpvYavnuLE=' 
WHERE 
  key_id = '08f8aa00335afc26c383e713e2d773a75e021d6f0097e277b6752dbfcb204890' 
  AND (
    token = 'Cf8ITIYPLlZof1VuNxumItdsQEnrG5nQ5hpvYavnuLE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048