UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RD4r6QTNNavbhAKObXFIhmEFmNLsAn3c0kXxHZ82vaY='
WHERE
key_id = '0a6771a97e4381bd78a89fed301791ad4bad3f434b9da7ef0be86364da91efd0'
AND (
token = 'RD4r6QTNNavbhAKObXFIhmEFmNLsAn3c0kXxHZ82vaY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)