UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cEt4VckRK+9Y1Q4drUZKip7DDJLQQi9P2gKBJ1wzOSg='
WHERE
key_id = 'f22eb3c9d07003eb6329cff4ecc5691fd039c2fb43926b302fa4e247e394d40e'
AND (
token = 'cEt4VckRK+9Y1Q4drUZKip7DDJLQQi9P2gKBJ1wzOSg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)