UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KqaULdBs+I0S40c3vEyA9WYctojQU8PsE78wCaz7UEI='
WHERE
key_id = '1324f540cd7e738266558fb75e4ba2c4bbb5cfcfee08be1a4b77898dadac2840'
AND (
token = 'KqaULdBs+I0S40c3vEyA9WYctojQU8PsE78wCaz7UEI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)