UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'U8rpvQd2KHfMVDHETh09dFXZpZDF6wh++rHjnB1fcjM='
WHERE
key_id = 'a767a97b014623b884ce3e3ea307ea953913bda05cc564bbb594aae24a16bbad'
AND (
token = 'U8rpvQd2KHfMVDHETh09dFXZpZDF6wh++rHjnB1fcjM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)