UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yWr91klZbTRVLbKgD7RcqB2vkDyZ+A2+nqxVs4eKlho='
WHERE
key_id = '5a62b220721606bb083cd68de1e556e39c0edda2b17a6e91aca8787bb8b4a668'
AND (
token = 'yWr91klZbTRVLbKgD7RcqB2vkDyZ+A2+nqxVs4eKlho='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)