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