UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G2xz8GX6Tsa5je56rzWnm9K8uyGHKWRkXa2YKwQV1dE='
WHERE
key_id = '17683f45084033174e7c21512f39f6d47ad0843b8b564a326016059cfb0d84ed'
AND (
token = 'G2xz8GX6Tsa5je56rzWnm9K8uyGHKWRkXa2YKwQV1dE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)