UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'drsZ2gW2UbxHnjxoGdrGS1kBjImtYU5O20+34LL+DYg='
WHERE
key_id = 'a1d1f84a694bdfe4a9605bca392a05cf35dbf4d5fc559e18145c9598516d0df8'
AND (
token = 'drsZ2gW2UbxHnjxoGdrGS1kBjImtYU5O20+34LL+DYg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)