UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qUPDBWOMFd3rxJzss2I4P1XsXB4a7qWSeM8Wjkn8Kfs=' 
WHERE 
  key_id = '286e404cd943a70c860d2eb9e8bd3908d734883f739d519e277363bc81168354' 
  AND (
    token = 'qUPDBWOMFd3rxJzss2I4P1XsXB4a7qWSeM8Wjkn8Kfs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033