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