UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p4mWuNS8taLqfm4Wwa586Unx6fN41BumkQfMRdOaiu4='
WHERE
key_id = '328c8c7942b4ff827c4e5c58150e72a659c5519a49911b678c74844da2efb65a'
AND (
token = 'p4mWuNS8taLqfm4Wwa586Unx6fN41BumkQfMRdOaiu4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)