UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iwOY1tLR0epQMtJIx0y96NMESe4vMGKyT7oj+d7QykE=' 
WHERE 
  key_id = 'a06f577da8943d39cdec556c321406d3d5ed096dc93276ba14bfc045abc8b90a' 
  AND (
    token = 'iwOY1tLR0epQMtJIx0y96NMESe4vMGKyT7oj+d7QykE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035