UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uFaryhsZ3ngXXlUJIHGH1apFTwEqTb+X98EahNhrUYw='
WHERE
key_id = 'cba773fd645eb2319cf66dd8150a8049233d2becda7ed47bbd132af4d3e16fa7'
AND (
token = 'uFaryhsZ3ngXXlUJIHGH1apFTwEqTb+X98EahNhrUYw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)