UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pjeAyD15yr5JdeYbVLMCZLXCMaU0ABlPgDeXOjV0KLQ=' 
WHERE 
  key_id = '5911788b84bad4e957b5236f8a46c5907fb6cb67b7faa3445d9a4f8fb63c366a' 
  AND (
    token = 'pjeAyD15yr5JdeYbVLMCZLXCMaU0ABlPgDeXOjV0KLQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019