UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fF+mtntV+JEkKUZC796BAhjI8QtvAcqwYjl3x0Ctlg4='
WHERE
key_id = '44caceab43fe05d59f9132257633445972b393e880e034154b978e7037a23b1c'
AND (
token = 'fF+mtntV+JEkKUZC796BAhjI8QtvAcqwYjl3x0Ctlg4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)