UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Uo7PjGqgwS+wD3wq9azqwoLiT3vn1fPDVEW5V9u5lm0='
WHERE
key_id = 'a5dea196c02387bd6f9c67d1aa123ef737ac6e77921af8168a83067e23cc6f59'
AND (
token = 'Uo7PjGqgwS+wD3wq9azqwoLiT3vn1fPDVEW5V9u5lm0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)