UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '80NYvrgUeePoTkbXMLMyjztXkJF1pqah1R+3lcBlvws='
WHERE
key_id = '22382627f18eab1a1b4c39d320fd42e22ece3cdef6b424f418687295a2a4ffed'
AND (
token = '80NYvrgUeePoTkbXMLMyjztXkJF1pqah1R+3lcBlvws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)