UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CwEyULBp/cYzHXoneBNSUPjPsFEp3rUmLxF2h/o6Zbw=' 
WHERE 
  key_id = 'a376e0fe1bc02a76e065b51a42da2f543b92522b913ddd82026c7d25de55e82e' 
  AND (
    token = 'CwEyULBp/cYzHXoneBNSUPjPsFEp3rUmLxF2h/o6Zbw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022