UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z/BaXwB2WN9E6oCW7+wpXIwkSYODH2fr57iyUi1kcho='
WHERE
key_id = 'cc57ec0e31bf50c75636bc1f99d24536bab503d5fc50b693d2e9ef89865fbc4f'
AND (
token = 'z/BaXwB2WN9E6oCW7+wpXIwkSYODH2fr57iyUi1kcho='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)