UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5zbYDfEuGPD3vREELqC+ethh4AdiD5mvaRzHXxv/+sg=' 
WHERE 
  key_id = '451d721da00e8fe5d515dc113d83eecc372591a1eed4e027a459ce309c0fa599' 
  AND (
    token = '5zbYDfEuGPD3vREELqC+ethh4AdiD5mvaRzHXxv/+sg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038