UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4fgjcc9X8fGwxekD852wobOX/eWrI0VJqvPnJ5YfPUk=' 
WHERE 
  key_id = '5c34a8e0c72c0fba477da7224d7324051f4077494c22dddeba8a98a1a039c30a' 
  AND (
    token = '4fgjcc9X8fGwxekD852wobOX/eWrI0VJqvPnJ5YfPUk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043