UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BQF4ch9JvqllsRWLIL+eJH+qPxk9NyD6st+GAvxqD10='
WHERE
key_id = '0f5ee04c974bec4d22c7a10b692ae578dec6f6049596f3c821d432453ee48d78'
AND (
token = 'BQF4ch9JvqllsRWLIL+eJH+qPxk9NyD6st+GAvxqD10='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)