UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PPkC0DJegpe3BFFAsEZn+sX4v0s6WvaGbuelYQV3zmI='
WHERE
key_id = 'b9cb65a384eec099e287ccb9e20803b9eb101e2ac71e9c70568482da066551f5'
AND (
token = 'PPkC0DJegpe3BFFAsEZn+sX4v0s6WvaGbuelYQV3zmI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)