UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OmCXdy8f7Q+aP5KRigsVmZOhcBCJ/PNoN4+1N02h0YE='
WHERE
key_id = '2fd2be68defca631602cc7124666b3bb532e568f00f154b93209ff97ec6cc59d'
AND (
token = 'OmCXdy8f7Q+aP5KRigsVmZOhcBCJ/PNoN4+1N02h0YE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)