UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FBl46BPOO+ZBh1m0dgHMl09F9lBZtHD9Dic/3knoo6E='
WHERE
key_id = 'f4be6112df1df717a19acdc6ffea8be8b3b1398e3a87a5c829aba9e255406c49'
AND (
token = 'FBl46BPOO+ZBh1m0dgHMl09F9lBZtHD9Dic/3knoo6E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)