UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/rMX6F+e8WuIySuK8ZQudioOBNwKhykhw74c67IguO0=' 
WHERE 
  key_id = '4d0e347423d775f936b6fb57ba72901927450e77d037eb784e46f17c2c221d13' 
  AND (
    token = '/rMX6F+e8WuIySuK8ZQudioOBNwKhykhw74c67IguO0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055