UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B6p1cUk5MwPYzep35G55dAvOqSrI/iD2xk+VSkD4etU='
WHERE
key_id = '6520621a0c68d91a97aaf6bd8f196753043048ab21432fe7fd0f100c9deedf01'
AND (
token = 'B6p1cUk5MwPYzep35G55dAvOqSrI/iD2xk+VSkD4etU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)