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

Query time 0.00028