UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3CUVWnJNmK+HALPQS4yyTr+/GMQ4hDFY7dccwaveJ6Q='
WHERE
key_id = 'b8159286507edb878fee784b6920130c054fd92f5e78a183a30a4a3c52d3fc58'
AND (
token = '3CUVWnJNmK+HALPQS4yyTr+/GMQ4hDFY7dccwaveJ6Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)