UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YVfCZmLRNEywe9evu6/WtW2HPJeYz8QLjButPO2uSFM=' 
WHERE 
  key_id = '574f06834c4df12aaa7203732b79e7b5c98e77a99b59905ab538d5fef3cf6758' 
  AND (
    token = 'YVfCZmLRNEywe9evu6/WtW2HPJeYz8QLjButPO2uSFM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035