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