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