UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ggRPEaRUb1D2IyeARxip6rD58i5NuUpCWvzAY/O3SmE=' 
WHERE 
  key_id = '7dab3868cf96f5276f8c44d17af479c9ec4b2fcb52fe18aa1e2a18b3feddbe3a' 
  AND (
    token = 'ggRPEaRUb1D2IyeARxip6rD58i5NuUpCWvzAY/O3SmE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017