UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FlTHbPzyTWyDuV8zaexm09eMMMjQ1U7OtrY1qeuVXZU='
WHERE
key_id = '859be8719cb3867fc5968ab4dc808126bfeeaf1114922f5f4723f63fb059cc22'
AND (
token = 'FlTHbPzyTWyDuV8zaexm09eMMMjQ1U7OtrY1qeuVXZU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)