UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oyLRJ00aYETRJYLIOPBFH9eKkcyrHa0lQJZCcKjlMiY='
WHERE
key_id = 'b6c3164a50d78e3e712164dea1eb9e7e0708c131d89517c4f6ddf43ca54da9c0'
AND (
token = 'oyLRJ00aYETRJYLIOPBFH9eKkcyrHa0lQJZCcKjlMiY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)