UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pTKoruEnnaC3lPuh1iV3hr58ICIez4Ou9KvHNMVBLtc='
WHERE
key_id = 'd1769e1a1ca11eb32063c93ed75cfdbda434ec54c4cc1e4d05f6beeef4633c27'
AND (
token = 'pTKoruEnnaC3lPuh1iV3hr58ICIez4Ou9KvHNMVBLtc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)