UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h1dp2Wy5FRB34e78aKKMaY/9OMbbAp3zZiJSQ1QLsec='
WHERE
key_id = 'ca80c7c78c1ea9919368940c4315417b8b53d3c6afb197c2e5b451d6aa24205f'
AND (
token = 'h1dp2Wy5FRB34e78aKKMaY/9OMbbAp3zZiJSQ1QLsec='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)