UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sUq7hrZCehGfzX420OXupq4ecU0goCwRQW2glDBAzFM=' 
WHERE 
  key_id = '4781b55d11e0aad95bffa162dd4ada7bdbb0514670f3c8fca7d5930e871761b3' 
  AND (
    token = 'sUq7hrZCehGfzX420OXupq4ecU0goCwRQW2glDBAzFM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062