UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k/Qvd61dMjNjjOnYdw97DtP/F9ZXeoj2LyUa6jj8Wts='
WHERE
key_id = '312c847e9b030f8cf90f335218fb47c71ce447142c7bb2c4b9f5604042230447'
AND (
token = 'k/Qvd61dMjNjjOnYdw97DtP/F9ZXeoj2LyUa6jj8Wts='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)