UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aRu6AqzDPBx3Q1o+L1o/s/my88HWoJ2u4oo/vS1cyOE=' 
WHERE 
  key_id = '234e6c9d86be748828cfd0ec1661766dcd9ee943f76d9050e68ff0f4b2f03794' 
  AND (
    token = 'aRu6AqzDPBx3Q1o+L1o/s/my88HWoJ2u4oo/vS1cyOE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027