UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g8RlvuJgAzbSf0v5Rwiry+TP9lTcezk5Tln3pFf44so='
WHERE
key_id = 'b30481edbe1e852effcd58cd358f3eed3b6cb8037b6f56836b5ef8fcc1f7c650'
AND (
token = 'g8RlvuJgAzbSf0v5Rwiry+TP9lTcezk5Tln3pFf44so='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)