UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yi3NAis83Wq8IsH/yj83cK0M0BazRvlTiB4Z9yBYQ3A='
WHERE
key_id = '79ba42a6e372ce3f40e9834620094c00c437bdd0831180f9b0dddc02b0b35ade'
AND (
token = 'yi3NAis83Wq8IsH/yj83cK0M0BazRvlTiB4Z9yBYQ3A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)