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