UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z3cUeewUtdyYFlqywkRyIUbE46YVPZ41Tajr+8szBmk='
WHERE
key_id = 'd48ca8c75c5308b6080464cfcc7d81d59e4a97872adeed7625a1c5f8a2927768'
AND (
token = 'Z3cUeewUtdyYFlqywkRyIUbE46YVPZ41Tajr+8szBmk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)