UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jn3r5t0HmN54+y82g/c6ZzBikHN7l/2xRyVcuWcMdRQ=' 
WHERE 
  key_id = 'dd520929c09989e241be6a27b3ed2afa26cdd5ecd0e8655910722245d3314a22' 
  AND (
    token = 'Jn3r5t0HmN54+y82g/c6ZzBikHN7l/2xRyVcuWcMdRQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018