UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FxvmvaSn5pDttlV4UtrNsBFMY58bXrVB3S6lTdssmao=' 
WHERE 
  key_id = '87affcbf5817ebd129c86facd2fd2eb2614d14dd7556eaa3f6c99fe9870b3e5d' 
  AND (
    token = 'FxvmvaSn5pDttlV4UtrNsBFMY58bXrVB3S6lTdssmao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043